//
//  UIColor+color.m
//  ZACommon
//
//  Created by NOMIS-WORKSPACE on 10/29/14.
//  Copyright (c) 2014 ZhanAo. All rights reserved.
//

#import "UIColor+color.h"

@implementation UIColor (extension)

+ (UIColor *)colorwithHexString:(NSString *)hexString alpha:(float)alpha
{
    return [[self colorwithHexString:hexString] colorWithAlphaComponent:alpha];
}

+ (UIColor *)colorwithHexString:(NSString *)hexString
{
    if (hexString == nil || (id)hexString == [NSNull null]) {
        return nil;
    }
    UIColor *col;
    if (![hexString hasPrefix:@"#"]) {
        hexString = [NSString stringWithFormat:@"#%@", hexString];
    }
    hexString = [hexString stringByReplacingOccurrencesOfString:@"#"
                                                     withString:@"0x"];
    uint hexValue;
    if ([[NSScanner scannerWithString:hexString] scanHexInt:&hexValue]) {
        col = [UIColor
               colorWithRed:((float)((hexValue & 0xFF0000) >> 16))/255.0
               green:((float)((hexValue & 0xFF00) >> 8))/255.0
               blue:((float)(hexValue & 0xFF))/255.0
               alpha:1.0f];
    } else {
        col = [UIColor clearColor];
    }
    return col;
}

@end

@implementation UIColor (color)

+ (UIColor *) bmMainColor{return [UIColor colorwithHexString:@"#20a5de"];}
+ (UIColor *) bmAssistanceColor1{return [UIColor colorwithHexString:@"#83c039"];}
+ (UIColor *) bmAssistanceColor2{return [UIColor colorwithHexString:@"#489c09"];}
+ (UIColor *) bmAssistanceColor3{return [UIColor colorwithHexString:@"#f72300"];}
+ (UIColor *) bmPageBackgroundColor{return [UIColor colorwithHexString:@"#f6f6f6"];}
+ (UIColor *) bmHintColor{return [UIColor colorwithHexString:@"#9f9f9f"];}
+ (UIColor *) bmContentColor{return [UIColor colorwithHexString:@"#454545"];}


@end
